package ru.lenwp.util;

import java.util.Scanner;

/**
 * @author: sk_y
 */
public class ConsoleUtil {

    public static int askMenuNumber(){
        Scanner sc = new Scanner(System.in);
        return sc.nextInt();
    }

    public static double askDouble(String massege){
        System.out.println(massege);
        Scanner sc = new Scanner(System.in);
        return sc.nextDouble();
    }

    public static String askString(){
        return askString(null);
    }

    public static String askString(String message){
        if(message != null) {
            System.out.println(message);
        }
        String res = "";
        Scanner scanner = new Scanner(System.in);
        while (res.trim().isEmpty()) {
            if (scanner.hasNext()) {
                res = scanner.next();
            }
        }
        return res.trim();
    }
}
